package com.young.coderule.service.impl;

import com.young.coderule.entity.ComCodeRuleNumber;
import com.young.coderule.service.CodeRuleCacheService;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @DESCRIPTION: 基于map的本地缓存，用来存储最大号信息
 * @USER: Young
 * @DATE: 2022/7/29 11:37
 */
public class CodeRuleMapCacheService implements CodeRuleCacheService {

    private Map<String, ComCodeRuleNumber> codeRuleNumberCacheMaps = new ConcurrentHashMap<>();

    @Override
    public ComCodeRuleNumber getCodeRuleNumber(String code) {
        return codeRuleNumberCacheMaps.get(code);
    }

    @Override
    public void putCodeRuleNumber(String code, ComCodeRuleNumber codeRuleNumber) {
        codeRuleNumberCacheMaps.put(code,codeRuleNumber);
    }
}
